<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <style  type="text/css">


        form{
            width: 400px;
            height: 300px;
            background: #afafaf;
            border: 2px solid red;
        }
        form.one{
            display: flex ;
            flex-flow: row nowrap;

        }

    </style>


</head>
<body>


<form>
    <div class="one"> <label>用户名</label>

        <input type="text" value="user"></div>
    <div class="one"> <label> 密码</label>
        <input type="password" value="password"></div>
    <input type="submit" value="提交">
    <input type="submit" value="重置">

</form>



</body>

<script src="www.lb.test/static/jquery.js"></script>
<script type="text/javascript">

    var userJobj=$(form)


    $("input[name='password']").blur(function () {


        var userElem=this;
        var val = userElem.value;
        if(val){
            $(this).parent().addClass("success").removeClass("error");

        }
        else {$(this).parent().addClass('error').removeClass('success');}

    });




</script>


</html>